package cn.com.utt.common.message;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;

public class Disconnect extends Message {
	@JSONField(name="connect") 
	private int connect;
	@JSONField(name="delay") 
	private int delay;

	public Disconnect() {
		setType(MessageType.DISCONNECT.toString());
	}

	@Override
	public String encode() {
		return JSON.toJSONString(this);
	}

	@Override
	public void decode(byte[] buf) {
		Disconnect disconnect = JSON.parseObject(buf, Disconnect.class);
		this.setId(disconnect.getId());
		this.connect = disconnect.getConnect();
		this.delay = disconnect.getDelay();
	}

	public int getConnect() {
		return connect;
	}

	public void setConnect(int connect) {
		this.connect = connect;
	}

	public int getDelay() {
		return delay;
	}

	public void setDelay(int delay) {
		this.delay = delay;
	}

}
